﻿/// <reference path="default.js" />
/// <reference path="jquery-1.4.2.min.js" />
/// <reference path="uploadify-v2.1.4/jquery.uploadify.v2.1.4.min.js" />
/// <reference path="uploadify-v2.1.4/swfobject.js" />
    //如果将JQuery的引用放在该处，则无法成功使用！不知道神马原因...
    LoadJS("/!js/uploadify-v2.1.4/swfobject.js");
    LoadJS("/!js/uploadify-v2.1.4/jquery.uploadify.v2.1.4.min.js");
    LoadCSS("/!js/uploadify-v2.1.4/uploadify.css");
$(document).ready(function () {

    var servicedate = $("[id$=hfadddate]").val().split('-');
    $("#uploadify").uploadify(
        {
            'uploader': '/!js/uploadify-v2.1.4/uploadify.swf',
            'script': '/Handler/UploadHandler.ashx',
            'cancelImg': '/!js/uploadify-v2.1.4/cancel.png',
            'folder': "/UploadFile/Temp/Video/" + servicedate[0] + "/" + servicedate[1] + "/" + servicedate[2] + "/",
            'queueID': 'fileQueue',
            'auto': false,
            'multi': true,
            'fileExt': '*.avi;*.mov;*.mpg;*.mp4;*.flv;*.wmv',
            'fileDesc': '请选择avi,mov,mpg,mp4,flv文件...',
            'buttonImg': '/!js/uploadify-v2.1.4/btn_uploadimg.jpg',
            'queueSizeLimit': 1,
            'scriptData': { 'ASPSESSID': $('hfAspSessID').val(), 'AUTHID': $('hfAuth').val() },
            'onComplete': function (event, queueID, fileObj, response, data) {
                $("[id$=hfpath]").val(response);
            },
            'onError': function (a, b, c, d) {
                if (d.status == 404) alert('Could not find upload script. Use a path relative to: ' + '<?= getcwd() ?>');
                else if (d.type === "HTTP") alert('error ' + d.type + ": " + d.info);
                else if (d.type === "File Size") alert(c.name + ' ' + d.type + ' Limit: ' + Math.round(d.sizeLimit / 1024) + 'KB');
                else
                    alert('error ' + d.type + ": " + d.info);
            }
        }
    );
});